package edu.sctu.zhoumengxue.day201505.day20150518.practice;

/**
 * Created by user12 on 2015/5/18.
 */
public class TextMore {
    public Teacher[] teacher;

    public TextMore(Teacher[] teacher){
        this.teacher = teacher;
    }
    public void sortNumber(){
//这个不是好会的，全凭记忆
        Teacher[] teacher1 = new Teacher[teacher.length];

        for (int i = 0; i < (teacher.length - 1); i++) {
            for (int j = 0; j < (teacher.length - 1); j++) {
                if (teacher[j].number > teacher[j + 1].number) {
                    teacher1[0] = teacher[j];
                    teacher[j] = teacher[j + 1];
                    teacher[j + 1] = teacher1[0];
                }

            }
        }
    }

    public void sortStudent(Student[] student){

        Student[] teacherA = new Student[student.length];

        for (int i = 0; i < (student.length - 1); i++) {
            for (int j = 0; j < (student.length - 1); j++) {
                if (student[j].number > student[j + 1].number) {
                    teacherA[0] = student[j];
                    student[j] = student[j + 1];
                    student[j + 1] = teacherA[0];
                }

            }
        }
    }

    public Teacher priCode(){
        Teacher teacher = null;
        for(Teacher teachers:this.teacher){
            if(teacher.work.equals("教授")){
                teacher = teachers;

            }

        }

        return teacher;

    }


}
